package com.youku.wangheng.test;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;

public class WriteFile {

	private static String filePath = "D:/test.dat";
	
	private static void writeFile() throws IOException {
		File file = new File(filePath);
		if(!file.exists()) {
			file.createNewFile();
		}
		FileWriter fileWriter = new FileWriter(file);
		try{
			fileWriter.append("第一行").append("\r\n");
			fileWriter.append("第二行").append("\r\n");
		} finally {
			fileWriter.close();
		}
	}
	
	public static void main(String[] args) throws IOException {
		writeFile();
	}
}
